import http from '@src/util/http';

/**
 * 管理报表 - 指标页 - 菜单(搜索菜单)
 * @param {String} params 
 * @returns Promise<>
 */

export function getReportThemeTree(params){
	let api = '/api/dataware/outside/reportTheme/getReportThemeTree/MANAGEMENTREPORT'
	if (params) {
		api = `/api/dataware/outside/reportTheme/getReportThemeTree/MANAGEMENTREPORT/${params}`
	}
	return http.get(api)
}

// 导出平均响应时长下钻数据
export const exportResponsePartData = (params) => {
  return http.post('/api/dataware/outside/resperiod/exportPartData', params)
}

// 导出平均服务用时下钻数据
export const exportServicePartData = (params) => {
  return http.post('/api/dataware/outside/turnaround/exportPartData', params)
}

// 导出平均维修用时下钻数据
export const exportMaintenancePartData = (params) => {
  return http.post('/api/dataware/outside/mintenance/exportPartData', params) 
}

// 导出及时关单率下钻数据
export const exportClosingPartData = (params) => {
  return http.post('/api/dataware/outside/delivery/exportData', params) 
}

// 导出服务人效下钻数据
export const exportHumanPartData = (params) => {
  return http.post('/api/dataware/outside/productivity/exportPartData', params) 
}

// 导出重复维修率下钻数据
export const exportRepeatedPartData = (params) => {
  return http.post('/api/dataware/outside/repeated/exportBrokenPartData', params) 
}

// 导出重复维修率下钻工单数据
export const exportRepeatedTaskPartData = (params) => {
  return http.post('/api/dataware/outside/repeated/exportMaintenanceTaskData', params) 
}

// 导出工单回访率下钻数据
export const exportTaskReturnPartData = (params) => {
  return http.post('/api/dataware/outside/review/exportPartData', params) 
}

// 导出工单客户满意度饼图下钻数据
export const exportTaskSatisfactionPiePartData = (params) => {
  return http.post('/api/dataware/outside/satisfaction/exportPinePartData', params) 
}

// 导出工单客户满意度饼图下钻工单数据
export const exportTaskSatisfactionPieTaskPartData = (params) => {
  return http.post('/api/dataware/outside/satisfaction/exportPineTaskData', params) 
}

// 导出工单客户满意度折线下钻数据
export const exportTaskSatisfactionBrokenLinePartData = (params) => {
  return http.post('/api/dataware/outside/satisfaction/exportBrokenPartData', params) 
}

// 获取及时关单率图表数据
export const getCloseAroundData = (params) => {
  return http.post('/api/dataware/outside/delivery/getCloseAroundData', params)
}

// 获取工单满意度-满意度构成图表数据
export const getSatisfactionPine = (params) => {
  return http.post('/api/dataware/outside/satisfaction/getSatisfactionPine', params)
}

// 获取收支结构分析总利润图表数据
export const getProfitData = (params) => {
  return http.post('/api/dataware/outside/analysis/getProfitData', params)
}

// 获取收支结构分析部门收入排行
export const getIncomeRanking = (params) => {
  return http.post('/api/dataware/outside/analysis/getIncomeRanking', params)
}

// 获取收支结构分析部门利润排行
export const getProfitRanking = (params) => {
  return http.post('/api/dataware/outside/analysis/getProfitRanking', params)
}

// 获取备件销售结构图数据
export const getSalesStructureData = (params) => {
  return http.post('/api/dataware/outside/delivery/getSalesStructureData', params)
}

// 获取服务项目收入与利润数据
export const getServiceIncomeProfitData = (params) => {
  return http.post('/api/dataware/outside/delivery/getServiceIncomeProfitData', params)
}

// 获取备件销售结构图数据
export const getSpareIncomeProfitData = (params) => {
  return http.post('/api/dataware/outside/delivery/getSpareIncomeProfitData', params)
}

// 获取重复维修率折线数据
export const getRepeatBroken = (params) => {
  return http.post('/api/dataware/outside/repeated/getRepeatBroken', params)
}

// 获取满意度饼图下钻工单数据
export const getSatisfactionPineTaskData = (params) => {
  return http.post('/api/dataware/outside/satisfaction/getSatisfactionPineTaskData', params)
}

// 重复维修率下钻工单数据
export const getRepeatBrokenTaskData = (params) => {
  return http.post('/api/dataware/outside/repeated/getRepeatBrokenTaskData', params)
}

// 下钻连接查看权限
export const getUserModuleAuth = () => {
  return http.get('/api/dataware/outside/user/userAuth');
}

// 获取自定表单列表（paas）
export const getCustomReportTemplate = () => {
  return http.get('/api/dataware/outside/custom/report/paas/template/all');
}

// 获取统计指标
export const getStatisticsField = (params = {}) => {
  return http.get('/api/dataware/outside/custom/report/statistics/field', params)
}

// 新建报表分组名称
export const getGroupingNameList = (params = {}) => {
  return http.get('', params)
}

// 新建新建报表
export const reportCreate = (params) => {
  return http.post('/api/dataware/outside/custom/report/create', params)
}

// 新建更新报表
export const reportUpdate = (params) => {
  return http.post('/api/dataware/outside/custom/report/update', params)
}

// 获取分组列表
export const getReportGroupList = (params) => {
  return http.get('/api/dataware/outside/reportTheme/getGroup', params)
}

// 获取指定的的自定义报表
export const reportGet = (params = {}) => {
  return http.get('/api/dataware/outside/custom/report/get', params); 
}

// 创建自定义视图
export const createView = (params = {}) => {
  return http.post('/api/dataware/outside/custom/report/createView', params) 
}

// 获取自定义视图
export const getView = (params = {}) => {
  return http.get('/api/dataware/outside/custom/report/getView', params) 
}
// 获取自定义视图
export const reportDelete = (params = {}) => {
  return http.post('/api/dataware/outside/custom/report/delete', params, false) 
}

// 修改自定义视图
export const updateView = (params = {}) => {
  return http.post(`/api/dataware/outside/custom/report/updateView?customId=${params.customId}`, params) 
}

// 工单类型
export const taskType = () => {
  return http.get('/api/dataware/outside/stats/staff/taskType')
}

